#![allow(dead_code)]

/// '''rust
/// pub trait Deref {
///     type Target: ?Sized;
///
///     //Required method
///     fn deref(&self) -> &Self::Target;
/// }
/// '''
///
struct AddLrn {}

impl AddLrn {
    pub fn hello() {
        println!("Add learning!");
    }
}

#[cfg(test)]
mod tests {
    // use super::*;
    #[test]
    fn test_add() {
        use std::ops::Add;

        #[derive(Debug, Copy, Clone, PartialEq)]
        struct Point<T> {
            x: T,
            y: T,
        }

        impl<T: Add<Output = T>> Add for Point<T> {
            type Output = Self;

            fn add(self, other: Self) -> Self::Output {
                Self {
                    x: self.x + other.x,
                    y: self.y + other.y,
                }
            }
        }

        assert_eq!(
            Point { x: 1, y: 0 } + Point { x: 2, y: 3 },
            Point { x: 3, y: 3 }
        );
    }
}
